/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

/* Includes ------------------------------------------------------------------*/
#include "stm32f0xx.h"
#include "stm32f0xx_it.h"
#include "utils.h"
#include "fifo.h"
#include "adc.h"

/* Exported types ------------------------------------------------------------*/
typedef enum {
	SEL1 = 0,
	SEL2,
	SEL3,
	SEL4,
	GRP1,
	GRP2,
	GRP3,
	GRP4,
	AUX1,
	AUX2,
	AUX3,
	AUX4,
	USART_DIR
} GPIOSignals_enum;

typedef struct {
	uint32_t RCC_AHBPeriph;
	GPIO_TypeDef*  GPIO_Port; 
	uint32_t GPIO_Pin;
	uint8_t  default_value;
} gpio_struct;
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
#define COUNT_OF(array) (sizeof(array) / sizeof(array[0]))
/* Exported functions ------------------------------------------------------- */
void scheduler (void);
/* Private defines -----------------------------------------------------------*/

/* USART Communication boards Interface */
#define USART_BAUDRATE                   38400

#define USARTx                           USART1
#define USARTx_CLK                       RCC_APB2Periph_USART1
#define USARTx_APBPERIPHCLOCK            RCC_APB2PeriphClockCmd
#define USARTx_IRQn                      USART1_IRQn
#define USARTx_IRQHandler                USART1_IRQHandler

#define USARTx_TX_PIN                    GPIO_Pin_9
#define USARTx_TX_GPIO_PORT              GPIOA
#define USARTx_TX_GPIO_CLK               RCC_AHBPeriph_GPIOA
#define USARTx_TX_SOURCE                 GPIO_PinSource9
#define USARTx_TX_AF                     GPIO_AF_1

#define USARTx_RX_PIN                    GPIO_Pin_10
#define USARTx_RX_GPIO_PORT              GPIOA
#define USARTx_RX_GPIO_CLK               RCC_AHBPeriph_GPIOA
#define USARTx_RX_SOURCE                 GPIO_PinSource10
#define USARTx_RX_AF                     GPIO_AF_1

#define USARTx_DIR_PIN                   GPIO_Pin_11
#define USARTx_DIR_GPIO_PORT             GPIOA
#define USARTx_DIR_GPIO_CLK              RCC_AHBPeriph_GPIOA
//#define USARTx_DIR_SOURCE                GPIO_PinSource11

#endif /* __MAIN_H */
